package com.system.mapper;

import com.order.hit.crossover.platform.common.dao.StoreValueDao;
import org.apache.ibatis.annotations.*;

public interface StoreValueMapper
{
    @Select("SELECT * FROM store_valueweight WHERE store_id = #{storeId}")
    @Results({
            @Result(property = "ID", column = "ID"),
            @Result(property = "store_id", column = "store_id"),
            @Result(property = "customer_satisfy_weight", column = "customer_satisfy"),
            @Result(property = "profit_weight", column = "profit"),
            @Result(property = "sale_weight", column = "sale"),
            @Result(property = "sales_volume_weight", column = "sales_volume")
    })
    public StoreValueDao getByStoreId(@Param("storeId") String storeId);

    @Insert("insert into store_valueweight(store_id, customer_satisfy, profit, sale, sales_volume)" +
            " values(#{store_id}, #{customer_satisfy_weight}, #{profit_weight}, #{sale_weight}, #{sales_volume_weight})")
    @Results({
            @Result(property = "ID", column = "ID"),
            @Result(property = "store_id", column = "store_id"),
            @Result(property = "customer_satisfy_weight", column = "customer_satisfy"),
            @Result(property = "profit_weight", column = "profit"),
            @Result(property = "sale_weight", column = "sale"),
            @Result(property = "sales_volume_weight", column = "sales_volume")
    })
    public void add(StoreValueDao valueDao);

    @Update("update store_valueweight set customer_satisfy=#{customer_satisfy_weight}, " +
            "profit=#{profit_weight}, sale=#{sale_weight}, sales_volume=#{sales_volume_weight} " +
            "where store_id=#{store_id}")
    public void update(StoreValueDao valueDao);

    @Delete("delete from store_valueweight where store_id = #{storeId}")
    public void deletebyStoreId(@Param("storeId") String storeId);

}
